package org.meteorshower.employee_depart.service.Impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.meteorshower.employee_depart.dao.IDepartmentDao;
import org.meteorshower.employee_depart.entity.Department;
import org.meteorshower.employee_depart.service.DepartmentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

@Service
@Transactional(rollbackFor = Exception.class)
public class DepartmentServiceImpl extends ServiceImpl<IDepartmentDao, Department> implements DepartmentService {

    private final IDepartmentDao departmentDao;

    @Autowired
    public DepartmentServiceImpl(IDepartmentDao departmentDao) {
        this.departmentDao = departmentDao;
    }

    @Override
    public List<Department> getByName(String name) {
        return departmentDao.getByName(name);
    }
}
